// 

// 
let rootUrl = getScriptDir("HtmlXCore/")

console.log("当前路径......rootUrl" + rootUrl)


addScript(rootUrl + "src/CSUtils/CBytes.js")
addScript(rootUrl + "src/CSUtils/CBaseType.js")
addScript(rootUrl + "src/CSUtils/CString.js")
addScript(rootUrl + "src/CSUtils/CInt4.js")
addScript(rootUrl + "src/CSUtils/CFile.js")
addScript(rootUrl + "src/CSUtils/CLog.js")
addScript(rootUrl + "src/CSUtils/CUtil.js")
addScript(rootUrl + "src/CSUtils/AField.js")
addScript(rootUrl + "src/CSUtils/BinaryReader.js")
addScript(rootUrl + "src/CSUtils/binaryWriter.js")
addScript(rootUrl + "src/CSUtils/WeData.js")
addScript(rootUrl + "src/CSUtils/WeDataTools.js")

addScript(rootUrl + "src/JSUtils/CreateCard.js")
addScript(rootUrl + "src/JSUtils/JSQueue.js")
addScript(rootUrl + "src/JSUtils/CTree.js")
addScript(rootUrl + "src/JSUtils/CTree2.js")
addScript(rootUrl + "src/JSUtils/CMap.js")
addScript(rootUrl + "src/JSUtils/UIBase.js")
addScript(rootUrl + "src/JSUtils/CWeb.js")
addScript(rootUrl + "src/JSUtils/CardDrag.js")


// 

// 


// 

// 

function addScript(url) {
    console.log("加载js......jsPath=" + url)
    document.write("<script language=javascript src=" + url + "></script>");
}


function addScript2(url) {
    var script = document.createElement('script');
    script.setAttribute('type', 'text/javascript');
    script.setAttribute('src', url);
    document.getElementsByTagName('head')[0].appendChild(script);
}

///获取目录前缀
function getScriptDir(name) {
    let jsPath = "";

    function _getScriptDir(name) {
        let src = '', scrptList = document.scripts;
        for (let i = scrptList.length; i > 0; i--) {
            if (scrptList[i].src.indexOf(name) > -1) {
                src = scrptList[i].src;
                break;
            }
        }
        return src;
    }

    if (document.currentScript == null) {
        jsPath = _getScriptDir(name);
    } else {
        let index = document.currentScript.src.lastIndexOf(name)
        jsPath = document.currentScript.src.substring(0, index + name.length);
    }
    return jsPath;
}
